import { PureComponent } from 'react'
import { Divider, Input, Select, Button } from 'antd'
import StorageRackModal from 'components/modal/storageRackModal'
import SingleTable from 'components/table/index'
import styles from './storageRack.less'
const { Option } = Select
export default class StorageRack extends PureComponent {
    state = {
        visible: false
    }
    renderModal(){
        const { visible } = this.state
        return(
            <StorageRackModal 
                visible={visible}
                onOk={this.handleOk}
                onCancel={this.handleCancel}
            />
        )
    }
    handleAdd = () => {
        this.setState({ visible: true})
    }
    handleOk = () => {
        this.setState({ visible: false})
    }
    handleCancel = () => {
        this.setState({ visible: false})
    }
    render(){
        const dataList = []
        const columns = [
        {
            key: 'gmtCreate',
            title: 'ID',
            dataIndex: 'gmtCreate',
            align: 'center',
        },
        {
            key: 'operationTypeName',
            title: '货架编号',
            dataIndex: 'operationTypeName',
            align: 'center',
        },
        {
            key: 'creatorName',
            title: '货架区域',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '4',
            title: '仓库编号',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '5',
            title: '所属仓库',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '6',
            title: '始发港',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '7',
            title: '目的港',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '8',
            title: '当前件数',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '9',
            title: '最近一次盘库时间',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '10',
            title: '创建时间',
            dataIndex: 'creatorName',
            align: 'center',
        },
        {
            key: '11',
            title: '操作',
            dataIndex: 'creatorName',
            align: 'center',
            render: (text, record) => (
                <span>
                  <a >编辑</a>
                  <Divider type="vertical" />
                  <a >删除</a>
                  <Divider type="vertical" />
                  <a >添加库位号</a>
                </span>
            )
        },
        ]
        return(
            <div className={styles.storageRack}>
                <div className={styles.storageRackBox}>
                    <h2>货架管理</h2>
                </div>
                <div className={styles.storageRackSearch}>
                    <div className={styles.storageRackSin}>
                        <span className={styles.storageRackSpan}>货架编号：</span>
                        <Input  className={styles.storageRackInput}/>
                    </div>
                    <div className={styles.storageRackSin} style={{margin: '0 28px'}}>
                        <span className={styles.storageRackSpan}>仓库名称：</span>
                        <Select defaultValue="lucy" className={styles.storageRackInput}>
                            <Option value="jack">Jack</Option>
                            <Option value="lucy">Lucy</Option>
                            <Option value="Yiminghe">yiminghe</Option>
                        </Select>
                    </div>
                    <div className={styles.storageRackSin}>
                        <span className={styles.storageRackSpan}>始发港：</span>
                        <Select defaultValue="lucy" className={styles.storageRackInput}>
                            <Option value="jack">Jack</Option>
                            <Option value="lucy">Lucy</Option>
                            <Option value="Yiminghe">yiminghe</Option>
                        </Select>
                    </div>
                    <div className={styles.storageRackSin} style={{marginLeft: '28px'}}>
                        <span className={styles.storageRackSpan}>目的港：</span>
                        <Select defaultValue="lucy" className={styles.storageRackInput}>
                            <Option value="jack">Jack</Option>
                            <Option value="lucy">Lucy</Option>
                            <Option value="Yiminghe">yiminghe</Option>
                        </Select>
                    </div>
                </div>
                <div className={styles.storageRackSearch}>
                    <div className={styles.storageRackSin}>
                        <span className={styles.storageRackSpan}>货架区域：</span>
                        <Select defaultValue="lucy" className={styles.storageRackInput}>
                            <Option value="jack">Jack</Option>
                            <Option value="lucy">Lucy</Option>
                            <Option value="Yiminghe">yiminghe</Option>
                        </Select>
                    </div>
                </div>
                <div className={styles.storageRackButton}>
                    <Button type="primary" icon="search" style={{marginRight: '24px'}}>查询</Button>
                    <Button icon="plus" onClick={this.handleAdd}>新建</Button>
                </div>
                <div className={styles.storageRackTable}>
                  <SingleTable
                    data={{ list: dataList }}
                    columns={columns}
                    
                    />
                </div>
                {this.renderModal()}
            </div>
        )
    }
}